package com.zoran.study.spring.helper;


import com.zoran.study.spring.model.Book;
import org.springframework.beans.factory.FactoryBean;

/**
 * MyFactoryBean
 *
 * @author zouxm
 * @date 2018/4/18
 */
public class MyFactoryBean implements FactoryBean<Book> {


    @Override
    public Book getObject() throws Exception {
        Book bean = new Book();
        bean.setBookName("java in action");
        return bean;
    }

    @Override
    public Class<?> getObjectType() {
        return Book.class;
    }

    //控制getObject对象是否为单例
    @Override
    public boolean isSingleton() {
        return true;
    }


}
